package com.cxlin.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment

/**
 *
 * @Author: chenxunlin
 * @Date: 2024/4/25 14:15
 */
abstract class BaseFragment: Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return inflater.inflate(getLayoutId(),container,false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        initView()
        observeStateAndEvent()
        initData()
        super.onViewCreated(view, savedInstanceState)
    }

    abstract fun getLayoutId():Int

    abstract fun initView()

    abstract fun initData()

    abstract fun observeStateAndEvent()
}